<template>
  <div style="display: inline">
    <el-button
      @click="deleteStock"
      type="info"
      class="mgr10 mgb10"
    >删除库存使用</el-button>
  </div>

</template>

<script>
import {deleteStickerOrder} from "@/api/order";

export default {
  name: "deleteStockOrder",
  props:{
    orderId:{
      type: String,
      required: true,
    }
  },
  methods:{
    deleteStock(){
      this.$confirm('删除后订单将重新变为未处理状态，请重新处理', '确认删除当前库存的使用？', {
        dangerouslyUseHTMLString: true,
        confirmButtonText: '确定',
        cancelButtonClass: '取消'
      })
        .then(res=>{
          deleteStickerOrder(this.orderId)
            .then(res=>{
              if(res.error === 0){
                this.$successMessage(res.message)
                this.$emit('changeOrder',true)
              }else{
                this.$errorMessage(res.message)
              }
            })
        })
        .catch(res=>{
          // 点击了取消
        });
    }
  }
}
</script>

<style scoped>

</style>
